﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

namespace Yozeev.Migrations
{
    public partial class Detele_TicketPrice_schedule : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_PriceAudits_Schedules_ScheduleId",
                schema: "Ticket",
                table: "PriceAudits");

            migrationBuilder.DropForeignKey(
                name: "FK_TicketPrices_Schedules_ScheduleId",
                schema: "Ticket",
                table: "TicketPrices");

            migrationBuilder.DropForeignKey(
                name: "FK_TicketScheduleEnables_Tickets_TicketId",
                schema: "Ticket",
                table: "TicketScheduleEnables");

            migrationBuilder.DropIndex(
                name: "IX_TicketScheduleEnables_TicketId",
                schema: "Ticket",
                table: "TicketScheduleEnables");

            migrationBuilder.DropIndex(
                name: "IX_TicketPrices_ScheduleId",
                schema: "Ticket",
                table: "TicketPrices");

            migrationBuilder.DropIndex(
                name: "IX_PriceAudits_ScheduleId",
                schema: "Ticket",
                table: "PriceAudits");

            migrationBuilder.DropColumn(
                name: "TicketId",
                schema: "Ticket",
                table: "TicketScheduleEnables");

            migrationBuilder.DropColumn(
                name: "ScheduleId",
                schema: "Ticket",
                table: "TicketPrices");

            migrationBuilder.DropColumn(
                name: "ScheduleId",
                schema: "Ticket",
                table: "PriceAudits");

            migrationBuilder.AddColumn<Guid>(
                name: "TicketPriceId",
                schema: "Ticket",
                table: "TicketScheduleEnables",
                maxLength: 65,
                nullable: true);

            migrationBuilder.AddColumn<Guid>(
                name: "ScheduleId",
                schema: "Ticket",
                table: "ActivityTempDetails",
                nullable: true);

            migrationBuilder.AddColumn<Guid>(
                name: "ScheduleId",
                schema: "Ticket",
                table: "ActivityDetails",
                maxLength: 65,
                nullable: true);

            migrationBuilder.CreateIndex(
                name: "IX_TicketScheduleEnables_TicketPriceId",
                schema: "Ticket",
                table: "TicketScheduleEnables",
                column: "TicketPriceId");

            migrationBuilder.CreateIndex(
                name: "IX_ActivityTempDetails_ScheduleId",
                schema: "Ticket",
                table: "ActivityTempDetails",
                column: "ScheduleId");

            migrationBuilder.CreateIndex(
                name: "IX_ActivityDetails_ScheduleId",
                schema: "Ticket",
                table: "ActivityDetails",
                column: "ScheduleId");

            migrationBuilder.AddForeignKey(
                name: "FK_ActivityDetails_Schedules_ScheduleId",
                schema: "Ticket",
                table: "ActivityDetails",
                column: "ScheduleId",
                principalSchema: "Boat",
                principalTable: "Schedules",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_ActivityTempDetails_Schedules_ScheduleId",
                schema: "Ticket",
                table: "ActivityTempDetails",
                column: "ScheduleId",
                principalSchema: "Boat",
                principalTable: "Schedules",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_TicketScheduleEnables_TicketPrices_TicketPriceId",
                schema: "Ticket",
                table: "TicketScheduleEnables",
                column: "TicketPriceId",
                principalSchema: "Ticket",
                principalTable: "TicketPrices",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_ActivityDetails_Schedules_ScheduleId",
                schema: "Ticket",
                table: "ActivityDetails");

            migrationBuilder.DropForeignKey(
                name: "FK_ActivityTempDetails_Schedules_ScheduleId",
                schema: "Ticket",
                table: "ActivityTempDetails");

            migrationBuilder.DropForeignKey(
                name: "FK_TicketScheduleEnables_TicketPrices_TicketPriceId",
                schema: "Ticket",
                table: "TicketScheduleEnables");

            migrationBuilder.DropIndex(
                name: "IX_TicketScheduleEnables_TicketPriceId",
                schema: "Ticket",
                table: "TicketScheduleEnables");

            migrationBuilder.DropIndex(
                name: "IX_ActivityTempDetails_ScheduleId",
                schema: "Ticket",
                table: "ActivityTempDetails");

            migrationBuilder.DropIndex(
                name: "IX_ActivityDetails_ScheduleId",
                schema: "Ticket",
                table: "ActivityDetails");

            migrationBuilder.DropColumn(
                name: "TicketPriceId",
                schema: "Ticket",
                table: "TicketScheduleEnables");

            migrationBuilder.DropColumn(
                name: "ScheduleId",
                schema: "Ticket",
                table: "ActivityTempDetails");

            migrationBuilder.DropColumn(
                name: "ScheduleId",
                schema: "Ticket",
                table: "ActivityDetails");

            migrationBuilder.AddColumn<Guid>(
                name: "TicketId",
                schema: "Ticket",
                table: "TicketScheduleEnables",
                maxLength: 65,
                nullable: false,
                defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));

            migrationBuilder.AddColumn<Guid>(
                name: "ScheduleId",
                schema: "Ticket",
                table: "TicketPrices",
                maxLength: 65,
                nullable: false,
                defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));

            migrationBuilder.AddColumn<Guid>(
                name: "ScheduleId",
                schema: "Ticket",
                table: "PriceAudits",
                maxLength: 65,
                nullable: false,
                defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));

            migrationBuilder.CreateIndex(
                name: "IX_TicketScheduleEnables_TicketId",
                schema: "Ticket",
                table: "TicketScheduleEnables",
                column: "TicketId");

            migrationBuilder.CreateIndex(
                name: "IX_TicketPrices_ScheduleId",
                schema: "Ticket",
                table: "TicketPrices",
                column: "ScheduleId");

            migrationBuilder.CreateIndex(
                name: "IX_PriceAudits_ScheduleId",
                schema: "Ticket",
                table: "PriceAudits",
                column: "ScheduleId");

            migrationBuilder.AddForeignKey(
                name: "FK_PriceAudits_Schedules_ScheduleId",
                schema: "Ticket",
                table: "PriceAudits",
                column: "ScheduleId",
                principalSchema: "Boat",
                principalTable: "Schedules",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_TicketPrices_Schedules_ScheduleId",
                schema: "Ticket",
                table: "TicketPrices",
                column: "ScheduleId",
                principalSchema: "Boat",
                principalTable: "Schedules",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_TicketScheduleEnables_Tickets_TicketId",
                schema: "Ticket",
                table: "TicketScheduleEnables",
                column: "TicketId",
                principalSchema: "Ticket",
                principalTable: "Tickets",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);
        }
    }
}
